package com.example.myapplication.part11;

import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;

public class Message {
    private String text;
    private boolean isUser;
    private String time;

    public Message(String text, boolean isUser) {
        this.text = text;
        this.isUser = isUser;
        this.time = getCurrentTime();
    }

    private String getCurrentTime() {
        SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.getDefault());
        return sdf.format(new Date());
    }

    // Getters and setters
    public String getText() { return text; }
    public boolean isUser() { return isUser; }
    public String getTime() { return time; }
}